#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    int maxProfit(vector<int> &prices)
    {
        int sum = 0;
        for (size_t i = 0; i < prices.size() - 1; i++)
        {
            int change = prices[i + 1] - prices[i];
            if (change > 0)
                sum += change;
        }
        return sum;
    }
};

int main()
{
    vector<int> nums = {7, 1, 5, 3, 6, 4};
    Solution s;
    cout << s.maxProfit(nums) << endl;
    return 0;
}